<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" indent="yes" omit-xml-declaration="no"/>
  <xsl:key name="comps" match="Competence" use="Type" />
  
  <xsl:param name="type"/>
  
  


  <xsl:template match="Competences">

    <html>
      <head>
        <title>LesCV - Projet XML</title>
        <link rel="stylesheet" type="text/css" href="../style.css" />
        
      </head>
      <body>
      
      <div id="ban">
      </div>
         
       <div id="menu">
          <ul>
            <li><a href="../Accueil.html"><span>Accueil</span></a></li>
            <li><a href="../Presentation.html"><span>Présentation</span></a></li>
            <li><a href="index.html"><span>Les Domaines</span></a></li>
            <li><a href="../LesCV/index.html"><span>Les CV</span></a></li>
          </ul>
        </div>
        
        <div id="contenu">
          
          <xsl:choose>
           <xsl:when test="$type">
           
              <h1>Liste des compétences de <xsl:value-of select="$type"/></h1>
              <xsl:apply-templates select="Competence[Type = $type]" mode="type">
                <xsl:sort select="translate(Nom,' ','')"/>
              </xsl:apply-templates>
              
           </xsl:when>
           <xsl:otherwise>
           
              <h1>Liste des Competences</h1>
              
              <xsl:apply-templates select="Competence[count(. | key('comps', Type)[1]) = 1]" mode="list">
                <xsl:sort select="translate(Type,' ','')"/>
              </xsl:apply-templates>
              
           </xsl:otherwise>
        </xsl:choose>
          
          
        </div>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template match="Competence" mode="list">
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="Type"/><xsl:text>.html</xsl:text></xsl:attribute>
      <xsl:value-of select="Type"/>
    </xsl:element>
    <br />
  </xsl:template>
  
  <xsl:template match="Competence" mode="type">
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:text>../CvCompetence/</xsl:text><xsl:value-of select="@idC"/>.html</xsl:attribute>
      <xsl:value-of select="Nom"/>
    </xsl:element>
    <br />
  </xsl:template>
  

</xsl:stylesheet>
